package com.seuic.hnjiningposapp.hnapps.ui.view.dialog;

import android.content.Context;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ToastUtils;
import com.lxj.xpopup.core.BasePopupView;
import com.seuic.hnjiningposapp.R;
import com.seuic.hnjiningposapp.hnapps.util.GetMoneyLvUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * 他行取款 输入信息
 */
public class ToHelpFarmersWithdrawOtherPp extends BasePopupView {
    Unbinder bind;
    @BindView(R.id.accnum)
    TextView accnum;
    @BindView(R.id.usernmae)
    TextView usernmae;
    @BindView(R.id.balance)
    TextView balance;
    @BindView(R.id.inoutmoneyed)
    EditText inoutmoneyed;
    @BindView(R.id.sure_switchinfo_yesbtn)
    Button sureSwitchinfoYesbtn;

    ToOtherHMoneyCall mToOtherHMoneyCall;

    public ToHelpFarmersWithdrawOtherPp(@NonNull Context context, ToOtherHMoneyCall toOtherHMoneyCall) {
        super(context);
        this.mToOtherHMoneyCall = toOtherHMoneyCall;
    }

    @Override
    protected int getPopupLayoutId() {
        return R.layout.tohelpfarmerswithdrawotherpp;
    }

    @OnClick(R.id.sure_switchinfo_yesbtn)
    public void onViewClicked() {
        if (inoutmoneyed.getText().toString().equals("")) {
            ToastUtils.showLong("请输入您的取款金额");
            return;
        }
        mToOtherHMoneyCall.HMoneyCall(inoutmoneyed.getText().toString().trim());

    }

    String card_num;
    String user_name;
    String userbalance;

    public void setCard_num(String card_num) {
        this.card_num = card_num;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public void setUserbalance(String userbalance) {
        this.userbalance = userbalance;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        bind = ButterKnife.bind(this);
        accnum.setText(card_num);
        usernmae.setText(user_name);
        balance.setText(GetMoneyLvUtils.getMoney(userbalance));

    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
        //注解解绑
        if (bind != null && bind != Unbinder.EMPTY) {
            bind.unbind();
        }
        this.bind = null;
    }

    public interface ToOtherHMoneyCall {
        void HMoneyCall(String money);
    }
}
